<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var1 = {
            'name':'caipieyan',
            'age':12,
            'sex':'man',
            'hobby':'relax',
            wanto:'sleep'
        }
        let wanto = 12
        var1[wanto] = wanto

        console.log(var1.hobby)
        console.log(var1['sex'])
        console.log(var1[wanto])
        console.log(var1['wanto'])

        var people1  = {
            'name' : 'caipeiyan',
             'age' : 18,
             'hobby' : 'sleep',
             'work': function() {
             console.log(`我叫${this.name},今年${this.age},我今天来上班了`)
            }
        }
        people1.work()
        console.log(people1['work'])
        
        var Animal = {
        'LEG':'have',
         'MOSE':'have'
        }
        var Human = Object.create(Animal)
        Human.language = 'have'
        console.log(Human)
        console.log(Human.LEG)

        function Car() {}
        console.log(Car.prototype)

        //使用构建函数创建对象并具有原型的属性
        //原型链 cat1--->Cat(具有属性action='pao'和listen='erduo') ---->Object（所有对象的原型）
        function Cat(){
            this.jiaosheng = '喵喵喵'
            this.chi = '用爪子抓来吃'
        }
        Cat.prototype.action = 'pao'
        Cat.prototype.listen = 'erduo'

        var cat1 = new Cat()
        console.log(cat1)
        
        console.log('listen' in cat1)
        console.log(Object.keys(cat1))
        console.log(Object.entries(cat1))
    </script>


</head>
<body>
    
</body>
</html>